
// 放映厅类
class CinemaHall {
    private String name;
    private int rows;
    private int cols;

    public CinemaHall(String name, int rows, int cols) {
        this.name = name;
        this.rows = rows;
        this.cols = cols;
    }

    // 初始化座位
    public Seat[][] initSeats() {
        Seat[][] seats = new Seat[rows][cols];
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                seats[i][j] = new Seat(i + 1, j + 1);
            }
        }
        return seats;
    }

    // 获取总座位数
    public int getTotalSeats() {
        return rows * cols;
    }

    // 获取空座位数
    public int getAvailableSeats(Show show) {
        int count = 0;
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                if (!show.getSeats()[i][j].isSold()) {
                    count++;
                }
            }
        }
        return count;
    }

    // Getter和Setter
    public String getName() {
        return name;
    }

    public int getRows() {
        return rows;
    }

    public int getCols() {
        return cols;
    }
}

// 座位类
class Seat {
    private int row;
    private int col;
    private boolean isSold;

    public Seat(int row, int col) {
        this.row = row;
        this.col = col;
        this.isSold = false;
    }

    // 购票/退票时更新座位状态
    public void setSold(boolean sold) {
        this.isSold = sold;
    }

    // Getter和Setter
    public int getRow() {
        return row;
    }

    public int getCol() {
        return col;
    }

    public boolean isSold() {
        return isSold;
    }

    public String getSeatNumber() {
        return row + "排" + col + "座";
    }
}